\institute{A bookdown wrapper for ElegantBook}
\version{ElegantBook 4.1} % 当前使用的 elegantbook 宏包版本
\bioinfo{自定义}{信息}
\extrainfo{Victory won\rq t come to us unless we go to it. --- M. Moore}

\definecolor{customcolor}{RGB}{32,178,170}
\colorlet{coverlinecolor}{customcolor}

% 字体设置
% \setCJKmainfont[BoldFont={Heiti SC},ItalicFont={Hiragino Sans GB}]{Songti SC} 
% \setCJKsansfont[BoldFont={Heiti SC},ItalicFont={Heiti SC}]{Hiragino Sans GB} 
% \setCJKmonofont[BoldFont={Heiti SC},ItalicFont={Heiti SC}]{Hiragino Sans GB}

\setCJKmainfont[
  Path = {\string~/Library/Fonts/},
  BoldFont=NotoSansCJKsc-Bold,
  ItalicFont=NotoSerifCJKsc-SemiBold,
  Extension = .otf
  ]{NotoSerifCJKsc-Regular} 
\setCJKsansfont[
  Path = {\string~/Library/Fonts/},
  BoldFont=NotoSansCJKsc-Bold,
  Extension = .otf
  ]{NotoSerifCJKsc-SemiBold} 
\setCJKmonofont[
  Path = {\string~/Library/Fonts/},
  BoldFont=NotoSansCJKsc-Bold,
  ItalicFont=NotoSerifCJKsc-SemiBold,
  Extension = .otf
  ]{NotoSerifCJKsc-Regular} 

% \setCJKfamilyfont{zhsong}{Songti SC}
% \setCJKfamilyfont{zhhei}{Heiti SC} 
% \setCJKfamilyfont{zhkai}{PingFang SC} 
% \setCJKfamilyfont{zhfs}{Hiragino Sans GB}

\setCJKfamilyfont{zhsong}{Noto Serif CJK SC}
\setCJKfamilyfont{zhhei}{Noto Sans CJK SC} 
\setCJKfamilyfont{zhkai}{Noto Serif CJK SC SemiBold} 
\setCJKfamilyfont{zhfs}{Noto Serif CJK SC}

\newcommand*{\songti}{\CJKfamily{zhsong}} 
\newcommand*{\heiti}{\CJKfamily{zhhei}} 
\newcommand*{\kaishu}{\CJKfamily{zhkai}} 
\newcommand*{\fangsong}{\CJKfamily{zhfs}}

% 下面如果不注释就准备好 Logo 和封面图片
% \logo{logo-blue.png} % 图片尺寸 1:1
% \cover{cover.jpg} % 图片尺寸 1280 × 1024

% Cancel common factors in Math 
\usepackage[makeroom]{cancel}

\usepackage[export]{adjustbox} %Needed for max width
%\patchcmd{<command>}{<code to replace>}{<code>}{<success>}{<failure>}
%The following codes add max dimension option to includegraphics
%Gin@ii is from graphicx package and looks for a second optional argument
\expandafter\patchcmd\csname Gin@ii\endcsname 
{\setkeys{Gin}{#1}}
{\setkeys{Gin}{max width=\textwidth, max height=.5\textwidth,keepaspectratio,#1}}
{}
{}

\definecolor{colortip}{RGB}{81,183,73}
\definecolor{colornote}{RGB}{251,188,5}
\definecolor{colorwarn}{RGB}{255,83,59}
\definecolor{colorinfo}{RGB}{204,204,204}

\tcbset{
  colbacktitle=white,
  enhanced,
  attach boxed title to top center={yshift=-2mm},
  colback=white, % 背景色
  coltext=black, % 文本色
  leftrule=1mm,
  rightrule=.25mm,
  bottomrule=.25mm,
  toprule=.25mm,
  boxsep=1pt, % 文字和边框的空隙
  arc=1pt % 圆角
}

\newtcolorbox{rmdtip}[1]{
  title=#1,
  coltitle=colortip,
  colframe=colortip, % 边框色
}

\newtcolorbox{rmdnote}[1]{
  title=#1,
  coltitle=colornote,
  colframe=colornote % 边框色
}

\newtcolorbox{rmdwarn}[1]{
  title=#1,
  coltitle=colorwarn,
  colframe=colorwarn % 边框色
}

\newtcolorbox{rmdinfo}{
  colframe=colorinfo % 边框色
}

\frontmatter
